/**
 * Created by Administrator on 2015/12/24.
 */


module.exports = {
    respose: function (req, res, next) {

        //var param = req.params["param"];
        //console.log(param);
        var c = require('./../app.js');
        //console.log(c.returnIO());
        //console.log("dsd");
        //res.send("dssdsds");
        //var io=appjs.returnIO;
        //c.returnIO.sockets.emit('news', function (socket) {
        //    socket.emit('news', { hello: '??????1' });//?????????????????????????????????????????'new'?????????????????????????
        //});
        //c.returnIO().write('服务端应答：' + param);
        //console.log(c.returnCL());
        //console.log(c.returnCL());
        //req.session.client123 =c.returnCL();
        res.render("index", {clientList: c.returnCL()});
    },

    say:function(req,res,next){
        console.log('coming');
        var clientName=req.param("hidClientName");
        var serverSay=req.param("hidSay");
        var c = require('./../app.js');
        var cc= c.returnCLient();
        for(var i=0;i<cc.length;i++){
            console.log(cc[i].name);
            console.log(clientName);
            if(cc[i].name==clientName){
                console.log("coming coming");
                cc[i].write("服务端说："+serverSay);
                break;
            }
        }
        //res.render("index", {clientList: c.returnCL()});
        res.redirect("index");
    }
}
